<template>
	<view class="loginbox">
		<button open-type="getUserProfile" @getUserProfile="get_wx_user_profile" class="btn">{{$t('获取微信头像')}}</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				headImage: '',
			}
		},
		onShow() {
		  if (!uni.getStorageSync("user")) {
			    uni.redirectTo({
			    	url:'../../pages/my/login'
			    })
			}
		},
		methods: {
			get_wx_user_profile(){
				uni.getUserProfile({
					desc: this.$t('展示个人信息方便用户辨识身份'),
					lang: 'zh_CN',
					success: function(infoRes) {
						console.log("infoRes: " + JSON.stringify(infoRes));
					},
					fail:function(fail){
						
					},
					complete:function(complete){
						console.log("complete: " + JSON.stringify(complete));
					}
				});
			},
		}
	}
</script>

<style>
	.loginbox {
		margin-top: 30%;
	}
</style>
